//
// Created by ls on 23-12-22.
//
#include <iostream>
#include <string>

// string 求子串

void test01()
{
  const std::string str = "abcdefg";
  const std::string subStr = str.substr(1, 3);
  std::cout << "subStr = " << subStr << std::endl;
}


// 使用操作
void test02()
{
  std::string email = "zhangsan@sina.com";
  // 从邮件地址中 获取 用户名信息
  const std::string::size_type pos = email.find('@');
  const std::string subStr = email.substr(0, pos);
  std::cout << "subStr = " << subStr << std::endl;
}

int main()
{
  // test01();
  test02();
  return 0;
}